package cn.edu.zsc.study.repository;

import cn.edu.zsc.study.entity.Role;
import cn.edu.zsc.study.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface UserRolesReposity extends BaseMapper<UserRole> {

    @Select("select sr.* from sys_role sr left join sys_users_roles sur on sur.role_id = sr.id and sur.user_id = #{userId}")
    Set<Role> getRolesByUserId(Long userId);

}